# Overview

This replication file contains three folders which separately replicate the analyses for the data collected in Mexico, Indonesia, and Kenya. Each sub-folder outputs data tables which are then either inputted into the paper directly or read into the Python notebooks in the main replication folder. The Python notebooks create the consolidated (across the three countries) figures that are presented in the paper and in the SI. 

## Country-level analyses

For each country, we read in the raw data from various sources and output cleaned and weighted datasets for analysis. The replication folders contain these outputted cleaned and weighted datasets, in addition to other outputs that are read into the Python notebooks that create consolidated figures. Running the replication code will re-create these outputs. 

To run the analyses, first ensure that your working directory is set to this replication folder. 

The analyses for Mexico and Indonesia run data cleaning and analysis in separate scripts. First run the data cleaning scripts and then the analysis scripts in these folders. 

The script for Kenya cleans the data first and then runs the analysis. 

## Replicating the tables

Tables S2 - S8 are created from the country-specific analysis scripts. Each script includes code to estimate these summary statistics and indicates which statistics are included in each table. 

## Replicating the figures

After running all scripts within the country sub-folders, run the Python notebooks to create the consolidated figures presented in the paper. 

1. Before running them, ensure that you are using Python 3.6.10 with the following required packages:
	pandas==1.1.0
	numpy==1.19.2
	matplotlib==3.2.2
2. Open Jupyter notebook. 
3. First, run "allcountries_fbpopulation.ipynb", which cleans up the various country-level outputs for conformity. 
4. Then, run "allcountries_figures.ipynb", which will create Figures 2-5 from the main paper as well as Figure S1. 
5. As filepaths are relative, the working directory does not need to be set.

Note: Figure S4 is created in the "kenya replication" folder and instructions can be found in that folder's "README_Kenya_Replication.txt" file.
